import request from '@/utils/request'
import md5 from 'js-md5'

export function login(username, pwd, type) {
  //var password = md5(pwd)
  return request({
    url: '/login',
    method: 'POST',
    params: {
      username,
      password:pwd,
      type:type
    }
  })
}

// 用户密码重置
export function restUserPwd(params) {
  //var password = md5(params.password)
  //var newPassword = md5(params.newPassword)
  return request({
    url: '/sysUser/updatePassword',
    method: 'POST',
    params: {
      id: params.id,
      name: params.login_name,
      password:params.password,
      newPassword:params.newPassword
    }
  })
}

export function getRouter() {
  return request({
    url: '/menu/getMenuList',
    method: 'GET'
  })
}

export function getInfo() {
  return request({
    url: '/getSysUserInfo',
    method: 'POST'
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'get'
  })
}
